<template>
    <div class="recordItem">
        <!-- {{ newsList }} -->
        <van-cell-group>
            <van-cell
                center
                v-if="manageList"
                @click="pathGo(manageList)"
                :title="manageList.content ? manageList.content : manageList.comment"
                :value="moment(manageList.create_time).format('MM-DD hh:mm')"
            />
        </van-cell-group>
    </div>
</template>
<script setup>
import { useRouter, useRoute } from "vue-router";
import { Cell, CellGroup } from "vant";
import moment from "moment";
import { searchNewsLike } from "@/request/index";
import { defineProps, toRef, onBeforeMount, ref } from "vue";
const initProps = defineProps(["newsList"]);
let newsList = toRef(initProps, "newsList");
// console.log(newsList.value);
let manageList = ref([]);
let router = useRouter();
onBeforeMount(() => {
    if (newsList.value.content == undefined && newsList.value.comment == undefined) {
        searchNewsLike({ user_db: newsList.value.user_db, detail_id: newsList.value.detail_id }).then((data) => {
            manageList.value = data.row[0];
        });
    } else {
        manageList.value = newsList.value;
    }
});
// let user_id = localStorage.getItem("token");
const pathGo = (x) => {
    // console.log(x.comment_id);

    router.push({ path: "/newsDetail", query: { id: x.comment_id } });
    // undateUserWeb({ user_id, comment_db: "comment", comment_id: x.id }).then((data) => {
    //     console.log("undateUserWeb", data);
    // });
};
</script>
<style lang="scss">
.recordItem {
    .newsListLeft {
        width: 66%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    .recordLi {
        padding: 10px 0;
        box-sizing: border-box;
        border-bottom: 1px solid #ccc;
        display: flex;
        justify-content: space-between;
        min-height: 80px;
        h4 {
            font-size: 17px;
            line-height: 20px;
            margin-bottom: 0.2rem;
        }
        span {
            font-size: 12px;
        }
    }
    .newsListRight {
        width: 30%;
        background-color: transparent;
        border-radius: 0.32rem;
        overflow: hidden;

        img {
            width: 100%;
            border-radius: 12px;
            object-fit: cover;
            max-height: 2.6667rem;
        }
    }
}
</style>
